//
//  WWRequestAPI+MsgApi.m
//  WangLottery
//
//  Created by 黄修勇 on 12-9-14.
//
//

#import "WWRequestAPI+MsgApi.h"

@implementation WWRequestAPI (MsgApi)

-(long)getMsgWithTarget:(id)target{

    return [self requestWithAction:@"getpublist" paras:nil target:target parserSEL:@selector(msgDicForString:)];
}

-(long)getMsgListByType:(NSString *)msgID startNum:(NSInteger)startNum count:(NSInteger)count target:(id)target{

    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:
                       msgID,@"type",
                       [NSString stringWithFormat:@"%d",startNum],@"start",
                       [NSString stringWithFormat:@"%d",count],@"count", nil];
    return [self requestWithAction:@"getpublistone" paras:dic target:target parserSEL:@selector(msgListDicForString:)];
}

-(long)msgContentWithMsgID:(NSString *)msgID target:(id)target{

    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:msgID,@"id", nil];
    return [self requestWithAction:@"getpubone" paras:dic target:target parserSEL:@selector(msgListDicForString:)];
}
@end


@implementation WWDataParser (MsgParser)

-(NSDictionary *)msgDicForString:(NSString *)string{
    
    NSArray *keyArray=[NSArray arrayWithObjects:@"msgID",@"msgName",@"msgCount", nil];
    return [self resultDicByKeyArray:keyArray string:string];
}

-(NSDictionary *)msgListDicForString:(NSString *)string{

    NSArray *keyArray=[NSArray arrayWithObjects:@"msgID",@"classID",
                       @"msgTitle",@"msgDetail",@"addDate",@"msgPic", nil];
    return [self resultDicByKeyArray:keyArray string:string];
}

@end